package spring.library.LibraryProject.enums;


public enum BookStatusEnum {
    DELETE(-1, "删除"), BORROWABLE(1, "可借阅"), UNBORROWABLE(2, "不可借阅");

    private Integer code;
    private String desc;

    BookStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getMesByCode(Integer code) {
        return switch (code) {
            case -1 -> BookStatusEnum.DELETE.desc;
            case 1 -> BookStatusEnum.BORROWABLE.desc;
            case 2 -> BookStatusEnum.UNBORROWABLE.desc;
            default -> null;
        };
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
